<template>
  <view class="section-four flexc">
    <view class="header">
      <u-tabs
        :current="tabCurrent"
        :scrollable="true"
        :list="tabList"
        keyName="title"
        lineColor="#CB0011"
        :lineWidth="28"
        :lineHeight="2"
        @click="tabClick"
        :itemStyle="{
          height: '88rpx',
          fontSize: '28rpx',
          color: '#9695A3',
        }"
        :activeStyle="{ fontWeight: 'bold', color: '#000000' }"
        :inactiveStyle="{}"></u-tabs>
    </view>
    <template v-if="tabCurrent == 0 || tabCurrent == 2">
      <!-- 二级tab -->
      <view class="nav flex-center">
        <view :class="navIndex == 1 ? 'nav-ac' : ''" @click="navBtn(1)">
          产品数据统计
        </view>
        <view :class="navIndex == 2 ? 'nav-ac' : ''" @click="navBtn(2)">
          白条副品统计
        </view>
      </view>
    </template>
    <!-- 中间数据展示 发起提交-->
    <template v-if="tabCurrent == 0">
      <view class="flex1 over" style="padding-bottom: 50upx">
        <!-- 产品数据统计 -->
        <template v-if="navIndex == 1">
          <view class="mb16" v-for="(item, index) in list" :key="index">
            <view class="tip flex-between">
              <view class="">录入明细{{ index + 1 }}</view>
              <view
                class="del"
                v-if="!item.disabled"
                @click="() => list.splice(index, 1)">
                删除
              </view>
            </view>
            <view class="wrap">
              <view class="box flexc">
                <view class="">序号</view>
                <input
                  class="flex1"
                  type="text"
                  v-model="item.production_section_four_product_no"
                  placeholder="请输入 不输入自动生成" />
              </view>
              <view class="box flexc" @click="showDateBtn(index)">
                <view class="">
                  <text class="sc">*</text>
                  生产日期
                </view>
                <view class="box-b flex">
                  <input
                    class="flex1"
                    type="text"
                    disabled
                    v-model="item.pale_date"
                    placeholder="默认选择当天" />
                  <image
                    src="/static/login/pop-arrow.png"
                    mode="aspectFit"></image>
                </view>
              </view>
              <view class="box flexc" @click="showPrick(index)">
                <view class="">
                  <text class="sc">*</text>
                  产品名称
                </view>
                <view class="flex box-b">
                  <input
                    class="flex1"
                    type="text"
                    disabled
                    v-model="item.product_title"
                    placeholder="请选择" />
                  <image
                    src="/static/login/pop-arrow.png"
                    mode="aspectFit"></image>
                </view>
              </view>
              <view class="box flexc">
                <view class="">
                  <text class="sc">*</text>
                  规格
                </view>
                <input
                  class="flex1"
                  type="text"
                  disabled
                  v-model="item.sku_id"
                  placeholder="请选择" />
              </view>

              <view class="box flexc">
                <view class="">
                  <text class="sc">*</text>
                  数量(件)
                </view>
                <input
                  class="flex1"
                  v-model="item.num"
                  type="text"
                  placeholder="请输入" />
              </view>
              <view class="box flexc">
                <view class="">重量(kg)</view>
                <input
                  class="flex1"
                  v-model="item.weight"
                  type="decimal"
                  placeholder="请输入" />
              </view>
              <view
                class="flex-center add-icon"
                v-if="index == list.length - 1"
                @click="addList(0)">
                <image src="/static/order/add.png" mode="aspectFit"></image>
              </view>
            </view>
          </view>
        </template>
        <!-- 白条副品统计 -->
        <template v-else>
          <view class="wrap mb16">
            <view class="box flexc" @click="showDateBtn(0)">
              <view class="">
                <text class="sc">*</text>
                生产日期
              </view>
              <view class="box-b flex">
                <input
                  class="flex1"
                  type="text"
                  disabled
                  v-model="service_time"
                  placeholder="默认选择当天" />
                <image
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"></image>
              </view>
            </view>
          </view>
          <view class="wrap mb16">
            <view class="box flexc">
              <view class="">
                <text class="sc">*</text>
                日加工总数
              </view>
              <input
                class="flex1"
                type="text"
                v-model="total_num"
                placeholder="请输入 " />
            </view>
          </view>
          <view class="flex1 over">
            <view
              class="mb16"
              v-for="(parentItem, index) in list1"
              :key="index">
              <view class="tip flex-between">
                <view class=""></view>
                <view
                  class="del"
                  v-if="!parentItem.disabled"
                  @click="() => list1.splice(index, 1)">
                  删除
                </view>
              </view>

              <view class="wrap mb16">
                <view class="box flexc">
                  <view class="">序号</view>
                  <input
                    class="flex1"
                    type="text"
                    v-model="parentItem.production_section_four_white_bar_no"
                    placeholder="请输入 不输入自动生成" />
                </view>
                <view
                  class=""
                  v-for="(val, i) in parentItem.plate_train_json"
                  :key="i">
                  <view class="tip flex-between" v-if="!val.disabled">
                    <view class="">添加{{ i }}</view>
                    <view
                      class="del"
                      @click="() => list1[index].plate_train_json.splice(i, 1)">
                      删除
                    </view>
                  </view>

                  <view class="box flexc" @click="showFrmaerBtn(index, 2, i)">
                    <view class="">车牌号</view>
                    <view class="box-b flex">
                      <input
                        class="flex1"
                        type="text"
                        disabled
                        v-model="val.plate_number"
                        placeholder="请选择" />
                      <image
                        src="/static/login/pop-arrow.png"
                        mode="aspectFit"></image>
                    </view>
                  </view>
                  <view class="box flexc">
                    <view class="">车次</view>
                    <input
                      class="flex1"
                      type="text"
                      v-model="val.train_number"
                      placeholder="请输入,多个使用/隔开" />
                  </view>
                  <view
                    class="flex-center add-icon"
                    v-if="i == parentItem.plate_train_json.length - 1"
                    @click="addList(3, index)">
                    <image src="/static/order/add.png" mode="aspectFit"></image>
                  </view>
                </view>
                <view class="box flexc" @click="goyzh(index)">
                  <view class="">
                    <text class="sc">*</text>
                    养殖户
                  </view>
                  <view class="box-b flex">
                    <input
                      class="flex1"
                      type="text"
                      disabled
                      v-model="parentItem.farmer_title"
                      placeholder="请选择" />
                    <image
                      src="/static/login/pop-arrow.png"
                      mode="aspectFit"></image>
                  </view>
                </view>
                <!-- @click="showFrmaerBtn(index, 1)" -->
                <view class="box flexc">
                  <view class="">批次</view>
                  <view class="box-b flex">
                    <input
                      class="flex1"
                      type="text"
                      disabled
                      v-model="parentItem.batch_title"
                      placeholder="请选择" />
                    <!-- <image
                      src="/static/login/pop-arrow.png"
                      mode="aspectFit"></image> -->
                  </view>
                </view>
                <view class="box flexc">
                  <view class="">
                    <text class="sc">*</text>
                    总只数
                  </view>
                  <input
                    class="flex1"
                    type="number"
                    v-model="parentItem.total"
                    placeholder="请输入 " />
                </view>
                <view class="box flexc">
                  <view class="">总重量(kg)</view>
                  <input
                    class="flex1"
                    type="decimal"
                    v-model="parentItem.weight"
                    placeholder="请输入 " />
                </view>
                <view class="box flexc">
                  <view class="">
                    <text class="sc">*</text>
                    残鸭只数
                  </view>
                  <input
                    class="flex1"
                    type="number"
                    v-model="parentItem.residual_duck_num"
                    placeholder="请输入 " />
                </view>
                <view class="box flexc">
                  <view class="">残鸭重量(kg)</view>
                  <input
                    class="flex1"
                    type="decimal"
                    v-model="parentItem.residual_duck_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-tip">养殖副品</view>
                  <view class="box1-y" v-if="!showType">严重爬背</view>

                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'yz_pb')"
                      v-model="parentItem.yz_pb_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.yz_pb_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'yz_pb')">
                      {{ parentItem.yz_pb_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.yz_pb_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.yz_pb_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">断腿/断翅A</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'dt')"
                      v-model="parentItem.dt_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.dt_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'dt')">
                      {{ parentItem.dt_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.dt_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.dt_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-tip">抓伤副品</view>

                  <view class="box1-y" v-if="!showType">轻微爬背</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'qw_pb')"
                      v-model="parentItem.qw_pb_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.qw_pb_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'qw_pb')">
                      {{ parentItem.qw_pb_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.qw_pb_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.qw_pb_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">抓鸭红头</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'ht')"
                      v-model="parentItem.ht_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.ht_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'ht')">
                      {{ parentItem.ht_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.ht_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.ht_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">淤青红紫</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'yq')"
                      v-model="parentItem.yq_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.yq_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'yq')">
                      {{ parentItem.yq_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.yq_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.yq_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-tip">加工副品</view>
                  <view class="box1-y" v-if="!showType">断腿/断翅B</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'dt_t')"
                      v-model="parentItem.dt_t_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.dt_t_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'dt_t')">
                      {{ parentItem.dt_t_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.dt_num_t"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.dt_weight_t"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">放血红头</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'fx')"
                      v-model="parentItem.fx_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.fx_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'fx')">
                      {{ parentItem.fx_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.fx_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.fx_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">破皮_机器</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'pp_jq')"
                      v-model="parentItem.pp_jq_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.pp_jq_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'pp_jq')">
                      {{ parentItem.pp_jq_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.pp_jq_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.pp_jq_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">破皮_刀具</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'pp_dj')"
                      v-model="parentItem.pp_dj_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.pp_dj_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'pp_dj')">
                      {{ parentItem.pp_dj_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.pp_dj_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.pp_dj_weight"
                    placeholder="请输入 " />
                </view>
                <view class="box1 flexc">
                  <view class="box1-y" v-if="!showType">破嘴</view>
                  <view class="box1-y flex-between" v-else>
                    <input
                      type="text"
                      class="flex1"
                      @blur="editListTitle(parentItem, 'pz')"
                      v-model="parentItem.pz_title"
                      placeholder="请输入检验项目名称"
                      :disabled="parentItem.pz_disabled" />
                    <view class="x" @click="editListTitle(parentItem, 'pz')">
                      {{ parentItem.pz_disabled ? "修改" : "确认" }}
                    </view>
                  </view>
                  <view class="flex box1-t">
                    <view class="">副品数(只)</view>
                    <input
                      class="flex1"
                      type="number"
                      v-model="parentItem.pz_num"
                      placeholder="请输入 " />
                  </view>
                </view>
                <view class="box1 flex">
                  <view class="">副品重量(kg)</view>
                  <input
                    class="flex1 tr"
                    type="number"
                    v-model="parentItem.pz_weight"
                    placeholder="请输入 " />
                </view>
                <view
                  class="flex-center add-icon"
                  v-if="index == list1.length - 1"
                  @click="addList(1)">
                  <image src="/static/order/add.png" mode="aspectFit"></image>
                </view>
              </view>
            </view>
          </view>
        </template>
        <view class="wrap mb16">
          <view class="box flexc">
            <view class="">备注</view>
            <view class="" style="height: 400upx">
              <u--textarea
                v-model="info"
                border="none"
                style="height: 100%"
                height="200"
                maxlength="200"
                placeholder="请输入备注信息"
                count></u--textarea>
            </view>
          </view>
        </view>
        <record_status_userVue :formType="navIndex + 7" />
      </view>
      <view class="footer flex-between">
        <view class="box-icon column-flex-center" @click="submitBtn(0)">
          <image src="/static/order/5.png" mode="aspectFit"></image>
          <view class="">存草稿</view>
        </view>
        <view class="btn" @click="submitBtn(1)">提交</view>
      </view>
    </template>
    <!-- 养殖记录 -->
    <template v-if="tabCurrent == 2">
      <view class="search flex">
        <image src="/static/order/search.png" mode="aspectFit"></image>
        <input type="text" class="flex1" v-model="keyword" placeholder="搜索" />
      </view>
      <view class="flex1 over" style="padding-bottom: 50upx">
        <scroll-view
          scroll-y="true"
          style="height: 100%"
          @scrolltolower="loadingMore">
          <view class="content-wrap">
            <view
              class="content-box"
              v-for="(item, index) in scrollList"
              :key="index"
              @click="goDetail(item)">
              <view class="flex-between">
                <view class="flex">
                  <view :class="['t', item.status == 9 ? 'ac4' : '']">
                    {{ item.title }}
                  </view>
                  <view class="edit-text" v-if="item.pid > 0">修改</view>
                </view>
                <view class="t1">{{ item.created_at }}</view>
              </view>
              <view class="no flex-between">
                <view class="">
                  序号：{{
                    item.production_section_four_product_no ||
                    item.production_section_four_white_bar_no
                  }}
                </view>
                <view
                  class="cred"
                  v-if="item.pid > 0"
                  @click.stop="historyBtn(item)">
                  历史数据
                </view>
              </view>
              <view
                class="t2 mb12"
                v-if="item.pale_date || item.service_date || item.service_time">
                服务日期：{{
                  item.pale_date || item.service_date || item.service_time
                }}
              </view>
              <view class="t2" v-if="item.farmer_title">
                养殖户：{{ item.farmer_title }}
              </view>
              <view class="flex-between mt34">
                <view class="flex">
                  <image
                    v-if="item.status != 9"
                    class="img"
                    src="/static/order/3.png"
                    mode="aspectFit"></image>
                  <image
                    class="img"
                    src="/static/order/4.png"
                    v-if="item.status == 9"
                    mode="aspectFit"></image>
                  <!-- :class="item.status == 3 ? 'ac1' : 'ac'" -->
                  <text :class="['ac', item.status == 9 ? 'ac4' : '']">
                    {{ item.user_name }}
                  </text>
                </view>
                <!-- status 1通过 2拒绝 -->
                <view
                  :class="
                    item.status == 1 ||
                    item.status == 2 ||
                    item.status == 4 ||
                    item.status == 6
                      ? 'ac2'
                      : item.status == 8
                      ? 'ac3'
                      : 'ac4'
                  ">
                  {{ item.status_name }}
                </view>
              </view>
            </view>
          </view>
          <w_loadmore :status="loadStatus"></w_loadmore>
        </scroll-view>
      </view>
    </template>
    <!-- 查看报表 -->
    <template v-if="tabCurrent == 1">
      <view class="nav1 flex-between">
        <view class="flex" @click="() => (btShow = true)">
          <view class="">{{ btTitle }}</view>
          <image
            src="/static/order/d.png"
            class="d-icon"
            mode="aspectFit"></image>
        </view>
        <view class="flex" @click="exportInfo">
          <image
            src="/static/order/e.png"
            mode="aspectFit"
            class="e-icon"></image>
          <view class="nav1-text">导出</view>
        </view>
      </view>
      <view class="time-box">
        <view class="flex" @click="() => (showTime = true)">
          <view class="">选择时间</view>
          <image
            src="/static/order/d.png"
            mode="aspectFit"
            class="d1-icon"></image>
        </view>
        <view class="time-box-text">{{ showDateTitle }}</view>
      </view>
      <view class="flex1 over wrap1" style="padding-bottom: 50upx">
        <view class="">表单提交次数</view>
        <view class="wrap1-num">{{ total }}</view>
        <view class="wrap1-des">{{ btTitle }}</view>
        <view class="">
          <zb-table
            :show-header="true"
            :columns="column"
            :border="true"
            :flt="true"
            :cell-style="cellStyle"
            :cell-header-style="cellHeaderStyle"
            :data="tableData"></zb-table>
        </view>
        <view class="page-set">
          <uni-pagination
            title="标题文字"
            :current="page"
            @change="pageBtn"
            :total="total"></uni-pagination>
        </view>
      </view>
      <!-- 选择时间的弹框 -->
      <pop_timeVue
        :showTime="showTime"
        :mode="mode"
        @tiemCheck="tiemCheck"
        @confirmDate="confirmDate"
        @closeTime="() => (showTime = false)" />
    </template>
    <!-- 车牌号键盘 -->
    <u-keyboard
      ref="uKeyboard"
      @change="valChange"
      @backspace="backspace"
      mode="car"
      @confirm="() => (showCar = false)"
      @cancel="() => (showCar = false)"
      :show="showCar"></u-keyboard>

    <!-- 日期 -->
    <u-calendar
      :show="showDate"
      color="#DA4334"
      :maxDate="maxDate"
      :minDate="minDate"
      class="nowDate"
      :default-date="defaultDate"
      ref="dateNow"
      :month-num="12"
      @close="() => (showDate = false)"
      @confirm="confirmDate1"></u-calendar>
    <!-- 产品名称 -->
    <u-picker
      @cancel="() => (show = false)"
      @confirm="confirmPicker"
      :show="show"
      confirmColor="#DA4334"
      :columns="productList"
      keyName="title"></u-picker>
    <!-- 型号 -->
    <u-picker
      @cancel="() => (showFrmaer = false)"
      @confirm="confirmshowFrmaer"
      :show="showFrmaer"
      confirmColor="#DA4334"
      :columns="showFrmaerList"
      keyName="title"></u-picker>
    <!-- 查看数据的切换 -->
    <pop_nav-vue
      :show="btShow"
      :btList="btList"
      @popShowBtn="popShowBtn"
      @closeBtn="() => (btShow = false)" />
  </view>
</template>

<script>
const d = new Date();
const year = d.getFullYear();
let month = d.getMonth() + 1;
month = month < 10 ? `0${month}` : month;
const date = d.getDate() < 10 ? `0${d.getDate()}` : d.getDate();
const maxDate = new Date(year + 1, 0, 0).getTime();
const minDate = new Date(year, 0, 1).getTime();
const defaultDate = [`${year}-${month}-${date}`];
const monthNum = (year - 2022 + 1) * 12;
import utils from "../../../plugin/util.js";
import w_loadmoreVue from "../../../components/w_loadmore/w_loadmore.vue";
import pop_timeVue from "../../../components/order/pop_time.vue";
import pop_navVue from "../../../components/order/pop_nav.vue";
import record_status_userVue from "../../../components/order/record_status_user.vue";
import log from "../../../plugin/log.js";
export default {
  components: {
    record_status_userVue,
    pop_navVue,
    pop_timeVue,
    w_loadmoreVue,
  },
  data() {
    return {
      monthNum,
      maxDate,
      minDate,
      defaultDate: [`${year}-${month}-${date}`],
      loadStatus: "loadmore",
      showFrmaer: false,
      showFrmaerList: [],
      showCar: false,
      showCartIndex: 0,
      btIndex: 1,
      btShow: false, //查看数据的第一个选择框
      tabList: [
        {
          title: "发起提交",
          value: 0,
        },
        {
          title: "查看报表",
          value: 1,
        },
        {
          title: "查看数据",
          value: 2,
        },
      ],
      navIndex: 1,
      keyword: "",
      show: false,
      showDate: false,
      showIndex: 0,
      info: "",
      tabCurrent: 0,
      btList: {
        1: "产品数据统计",
        2: "白条副品统计",
      },

      btTitle: "产品数据统计",
      list: [
        {
          production_section_four_product_no: "",
          pale_date: "",
          product_id: "",
          product_title: "",
          sku_id: "",
          num: "",
          weight: "",
          disabled: true,
        },
      ],
      showType: false, //是否显示修改
      list2: [
        {
          production_section_four_white_bar_no: "",
          farmer_id: "",
          farmer_title: "",
          plate_train_json: [
            {
              plate_number: "",
              train_number: "",
              disabled: true,
            },
          ],

          total: "",
          weight: "",
          residual_duck_num: "",
          residual_duck_weight: "",
          yz_pb_num: "",
          yz_pb_weight: "",
          yz_pb_title: "严重爬背",
          yz_pb_disabled: true,
          dt_num: "",
          dt_weight: "",
          dt_title: "断腿/断翅A",
          dt_disabled: true,
          qw_pb_num: "",
          qw_pb_weight: "",
          qw_pb_title: "轻微爬背",
          qw_pb_disabled: true,
          ht_num: "",
          ht_weight: "",
          ht_title: "抓鸭红头",
          ht_disabled: true,
          yq_num: "",
          yq_weight: "",
          yq_title: "淤青红紫",
          yq_disabled: true,
          dt_num_t: "",
          dt_weight_t: "",
          dt_t_title: "断腿/断翅B",
          dt_t_disabled: true,
          fx_num: "",
          fx_weight: "",
          fx_title: "放血红头",
          fx_disabled: true,
          pp_jq_num: "",
          pp_jq_weight: "",
          pp_jq_title: "破皮_机器",
          pp_jq_disabled: true,
          pp_dj_num: "",
          pp_dj_weight: "",
          pp_dj_title: "破皮_刀具",
          pp_dj_disabled: true,
          pz_num: "",
          pz_weight: "",
          pz_title: "破嘴",
          pz_disabled: true,
          disabled: true,
          batch: "",
          batch_title: "",
        },
      ],
      list1: [
        {
          production_section_four_white_bar_no: "",
          farmer_id: "",
          farmer_title: "",
          plate_train_json: [
            {
              plate_number: "",
              train_number: "",
              disabled: true,
            },
          ],

          total: "",
          weight: "",
          residual_duck_num: "",
          residual_duck_weight: "",
          yz_pb_num: "",
          yz_pb_weight: "",
          yz_pb_title: "严重爬背",
          yz_pb_disabled: true,
          dt_num: "",
          dt_weight: "",
          dt_title: "断腿/断翅A",
          dt_disabled: true,
          qw_pb_num: "",
          qw_pb_weight: "",
          qw_pb_title: "轻微爬背",
          qw_pb_disabled: true,
          ht_num: "",
          ht_weight: "",
          ht_title: "抓鸭红头",
          ht_disabled: true,
          yq_num: "",
          yq_weight: "",
          yq_title: "淤青红紫",
          yq_disabled: true,
          dt_num_t: "",
          dt_weight_t: "",
          dt_t_title: "断腿/断翅B",
          dt_t_disabled: true,
          fx_num: "",
          fx_weight: "",
          fx_title: "放血红头",
          fx_disabled: true,
          pp_jq_num: "",
          pp_jq_weight: "",
          pp_jq_title: "破皮_机器",
          pp_jq_disabled: true,
          pp_dj_num: "",
          pp_dj_weight: "",
          pp_dj_title: "破皮_刀具",
          pp_dj_disabled: true,
          pz_num: "",
          pz_weight: "",
          pz_title: "破嘴",
          pz_disabled: true,
          disabled: true,
          batch: "",
          batch_title: "",
        },
      ],
      showFrmaerList0: [],
      showFrmaerList1: [],
      showFrmaerList2: [],
      showFrmaerList3: {},
      productList: [],
      scrollList: [],
      timeIndex: null,
      page: "1",
      limit: "10",
      total: 0,
      nomore: false,
      column: [],
      showDate: false, //日历弹框
      tableData: [],
      showTime: false,
      start_time: "",
      end_time: "",
      mode: "range", //single单个---range范围
      service_time: "",
      total_num: "",
      showDateTitle:
        utils.timeFormat(
          new Date(`${new Date().getFullYear()}` + "-" + "01-01")
        ) +
        "-" +
        utils.timeFormat(
          new Date(`${new Date().getFullYear()}` + "-" + "12-31")
        ),
      isDetail: false,
      info1: "",
      info2: "",
    };
  },
  created() {
    this.getProduct();
    // this.getBatch();
    //this.getFarmer();
    this.getDetail();
    this.getDetail1();
    this.getPlanNum();
    this.showEditBtn();
  },
  onReady() {
    this.showDate = false;
  },
  onShow() {
    if (uni.getStorageSync("productList")) {
      const { product_title, specifications, product_id, model_number } =
        JSON.parse(uni.getStorageSync("productList"));
      this.list[this.showIndex].product_id = product_id;
      this.list[this.showIndex].product_title = product_title;
      this.list[this.showIndex].sku_id = specifications;
      uni.removeStorageSync("productList");
    }
    if (this.isDetail) {
      this.page = 1;
      this.nomore = false;
      if (this.navIndex == 1) {
        this.getList();
      } else {
        this.getList1();
      }

      this.isDetail = false;
    }
    //养殖户返回，赋值
    if (uni.getStorageSync("checkAddress")) {
      const obj = JSON.parse(uni.getStorageSync("checkAddress"));
      if (this.navIndex != 1) {
        this.list1[this.showCartIndex].farmer_id = obj.farmer_id;
        this.list1[this.showCartIndex].farmer_title = obj.title;
        this.getBatch(obj.farmer_id);
      }
      //this.isyzh = false
      uni.removeStorageSync("checkAddress");
    }
  },
  methods: {
    goyzh(k) {
      this.showCartIndex = k;
      //this.isyzh = true
      this.toRoute("/select-address?isyzh=1");
    },
    showEditBtn() {
      this.$api({
        url: "/getUserRoleBySlug",
        method: "get",
        data: {
          slug: "four_white_bar",
        },
      }).then((res) => {
        if (res.code === 200) {
          this.showType = res.data;
        }
      });
    },
    //修改名称
    editListTitle(item, title) {
      item[`${title}_disabled`] = !item[`${title}_disabled`];
      if (item[`${title}_disabled`]) {
        if (!item[`${title}_title`]) {
          this.$alert("当前不能为空");
          item[`${title}_disabled`] = false;
          return;
        }
      }
    },
    cellStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex == 0) {
        return {
          color: "#DA4334",
          fontSize: "24rpx",
        };
      }
      if (
        (Object.keys(row)[6] == "status_text" && columnIndex === 6) ||
        (Object.keys(row)[28] == "status_text" && columnIndex === 28)
      ) {
        if (row.status_text.indexOf("失败") > -1) {
          return {
            color: "#DA4334",
            fontSize: "24rpx",
          };
        }
        if (row.status_text === "已撤销") {
          return {
            color: "#8d8d8d",
            fontSize: "24rpx",
          };
        }
      }
      return {
        color: "#171717",
        fontSize: "24rpx",
      };
    },
    cellHeaderStyle() {
      return {
        backgroundColor: "#F6F1F1",
        color: "#707072",
        fontSize: "24rpx",
      };
    },
    //获取批次
    getBatch(farmer_id) {
      // this.showFrmaerList1 = [];
      this.$api({
        url: "/batch_list",
        method: "get",
        data: { farmer_id },
      }).then((res) => {
        if (res.code === 200) {
          // res.data.forEach((item) => {
          // 	item.title = item.batch;
          // });
          this.list1[this.showCartIndex].batch_title =
            res.data.length > 0 ? res.data[0].batch : "";
          this.list1[this.showCartIndex].batch =
            res.data.length > 0 ? res.data[0].batch : "";
          // this.showFrmaerList1.push(res.data);
        }
      });
    },
    //放苗
    getDetail() {
      this.$api({
        url: "/get_production_section_four_product_detail",
        method: "get",
        data: {
          type: "1",
        },
      }).then((res) => {
        if (res.code === 200 && Object.keys(res.data).length > 0) {
          res.data.detail.forEach((item) => {
            item.disabled = false;
          });
          res.data.detail[0].disabled = true;
          this.list = res.data.detail;
          this.editId = res.data.id;
          this.info1 = res.data.info;
          this.info = this.info1;
        }
      });
    },
    //养殖
    getDetail1() {
      this.$api({
        url: "/get_production_section_four_white_bar_detail",
        method: "get",
        data: {
          type: "1",
        },
      }).then((res) => {
        if (res.code === 200 && Object.keys(res.data).length > 0) {
          res.data.detail.forEach((item) => {
            item.disabled = false;
            item.yz_pb_disabled = true;
            item.dt_disabled = true;
            item.qw_pb_disabled = true;
            item.ht_disabled = true;
            item.yq_disabled = true;
            item.dt_t_disabled = true;
            item.fx_disable = true;
            item.pp_jq_title = true;
            item.pp_dj_disabled = true;
            item.pz_disabled = true;
            item.batch_title = item.batch;
            // if (Object.keys(item).indexOf("plate_train_json") < 0) {
            item.plate_train_json[0].disabled = true;
            // item.plate_train_json = [
            //            {
            //              plate_number: "",
            //              train_number: "",
            //              disabled: true,
            //            },
            //          ];
            // }
          });
          res.data.detail[0].disabled = true;
          this.list1 = res.data.detail;
          this.service_time = res.data.service_time;
          this.total_num = res.data.total;
          this.editId1 = res.data.id;
          this.info2 = res.data.info;
        }
      });
    },
    //点击历史数据
    historyBtn(item) {
      this.toRoute({
        path: "section-detail",
        query: {
          id: item.pid,
          type: item.type, //1--放苗 2--养殖
        },
      });
    },
    exportInfo() {
      let obj = {
        type: this.timeIndex == null ? "" : this.timeIndex + 1,
        start_time: this.start_time,
        end_time: this.end_time,
        form_type: this.navIndex + 7,
      };
      this.$store.dispatch("exportInfo", obj);
    },
    //点击数据跳转到详情页面
    goDetail(item) {
      if (item.pid > 0) {
        this.toRoute({
          path: "edit-record",
          query: {
            id: item.id,
            type: this.navIndex + 7, //1--放苗 2--养殖
            pid: true,
          },
        });
      } else {
        this.toRoute({
          path: "section-detail",
          query: {
            id: item.id,
            type: this.navIndex + 7, //1--放苗 2--养殖
          },
        });
      }
      this.isDetail = true;
    },
    pageBtn(e) {
      this.page = e.current;
      if (this.navIndex == 1) {
        this.getSectionFour();
      } else {
        this.getSectionBy();
      }
    },
    getList(flg = false) {
      const page = flg ? this.page : (this.page = 1);
      this.$api({
        url: "/get_production_section_four_product_list",
        method: "get",
        data: {
          page,
          limit: this.limit,
          keyword: this.keyword,
        },
      }).then((res) => {
        if (res.code === 200) {
          if (flg) {
            this.scrollList = this.scrollList.concat(res.data.list);
          } else {
            this.scrollList = res.data.list;
          }
          this.nomore = res.data.total / this.limit > this.page ? false : true;
          this.loadStatus = this.nomore ? "nomore" : "loading";
        }
      });
    },
    getList1(flg = false) {
      const page = flg ? this.page : (this.page = 1);
      this.$api({
        url: "/get_production_section_four_white_bar_list",
        method: "get",
        data: {
          page,
          limit: this.limit,
          keyword: this.keyword,
        },
      }).then((res) => {
        if (res.code === 200) {
          if (flg) {
            this.scrollList = this.scrollList.concat(res.data.list);
          } else {
            this.scrollList = res.data.list;
          }

          this.nomore = res.data.total / this.limit > this.page ? false : true;
          this.loadStatus = this.nomore ? "nomore" : "loading";
        }
      });
    },
    popShowBtn(k) {
      this.btShow = false;
      this.page = 1;
      this.btTitle = this.btList[k];
      this.navIndex = k;
      if (k == 1) {
        this.getSectionFour();
      } else {
        this.getSectionBy();
      }
    },
    getSectionFour() {
      const type = this.timeIndex == null ? "" : this.timeIndex + 1;
      this.$api({
        url: "/get_production_section_four_product_detail_list",
        method: "get",
        data: {
          page: this.page,
          limit: this.limit,
          type,
          start_time: this.start_time,
          end_time: this.end_time,
        },
      }).then((res) => {
        this.total = res.data.total;
        this.tableData = res.data.list;
        this.showTime = false;
        this.column = [
          {
            name: "production_section_four_product_no",
            label: "序号",
            fixed: true,
            width: 80,
            align: "center",
            emptyString: "--",
          },
          {
            name: "pale_date",
            label: "生产日期",
            sorter: false,
            align: "center",
          },
          {
            name: "product_title",
            label: "产品名称",
            align: "center",
          },
          {
            name: "specifications",
            label: "规格",
            align: "center",
          },
          {
            name: "num",
            label: "数量",
            align: "center",
          },
          {
            name: "weight",
            label: "重量",
            align: "center",
          },
          {
            name: "status_text",
            label: "审核状态",
            sorter: false,
            align: "center",
          },
        ];
      });
    },
    getSectionBy() {
      const type = this.timeIndex == null ? "" : this.timeIndex + 1;
      this.$api({
        url: "/get_production_section_four_white_bar_detail_list",
        method: "get",
        data: {
          page: this.page,
          limit: this.limit,
          type,
          start_time: this.start_time,
          end_time: this.end_time,
        },
      }).then((res) => {
        this.total = res.data.total;
        this.tableData = res.data.list;
        this.showTime = false;
        this.column = [
          {
            name: "production_section_four_white_bar_no",
            label: "序号",
            fixed: true,
            width: 80,
            align: "center",
            emptyString: "--",
          },
          {
            name: "plate_number",
            label: "车牌号",
            sorter: false,
            align: "center",
          },
          {
            name: "train_number",
            label: "车次",

            align: "center",
          },
          {
            name: "farmer_title",
            label: "养殖户",
            align: "center",
          },
          {
            name: "total",
            label: "总只数",
            align: "center",
          },
          {
            name: "weight",
            label: "总重量",
            align: "center",
          },
          {
            name: "residual_duck_num",
            label: "残鸭只数",
            align: "center",
          },
          {
            name: "residual_duck_weight",
            label: "残鸭重量",
            align: "center",
          },
          {
            name: "yz_pb_num",
            label: "副品数(严重爬背)",
            align: "center",
          },
          {
            name: "yz_pb_weight",
            label: "副品重量(严重爬背)",
            align: "center",
          },
          {
            name: "dt_num",
            label: "副品数(断腿/断翅A)",
            align: "center",
          },
          {
            name: "dt_weight",
            label: "副品重量((断腿/断翅A))",
            align: "center",
          },
          {
            name: "qw_pb_num",
            label: "副品数(轻微爬背)",
            align: "center",
          },
          {
            name: "qw_pb_weight",
            label: "副品重量(轻微爬背)",
            align: "center",
          },
          {
            name: "ht_num",
            label: "副品数(抓鸭红头)",
            align: "center",
          },
          {
            name: "ht_weight",
            label: "副品重量(抓鸭红头)",
            align: "center",
          },
          {
            name: "yq_num",
            label: "副品数(淤青红紫)",
            align: "center",
          },
          {
            name: "yq_weight",
            label: "副品重量(淤青红紫)",
            align: "center",
          },
          {
            name: "dt_num_t",
            label: "副品数(断腿/断翅B)",
            align: "center",
          },
          {
            name: "dt_weight_t",
            label: "副品重量(断腿/断翅B)",
            align: "center",
          },
          {
            name: "fx_num",
            label: "副品数(放血红头)",
            align: "center",
          },
          {
            name: "fx_weight",
            label: "副品重量(放血红头)",
            align: "center",
          },
          {
            name: "pp_jq_num",
            label: "副品数(破皮_机器)",
            align: "center",
          },
          {
            name: "pp_jq_weight",
            label: "副品重量(破皮_机器)",
            align: "center",
          },
          {
            name: "pp_dj_num",
            label: "副品数(破皮_刀具)",
            align: "center",
          },
          {
            name: "pp_dj_weight",
            label: "副品重量(破皮_刀具)",
            align: "center",
          },
          {
            name: "pz_num",
            label: "副品数(破嘴)",
            align: "center",
          },
          {
            name: "pz_weight",
            label: "副品重量(破嘴)",
            align: "center",
          },
          {
            name: "status_text",
            label: "审核状态",
            sorter: false,
            align: "center",
          },
        ];
      });
    },
    tiemCheck({ k, data }) {
      this.timeIndex = k;
      this.showDateTitle = data;
      if (this.navIndex == 1) {
        this.getSectionFour();
      } else {
        this.getSectionBy();
      }
    },
    getPlanNum() {
      this.$api({
        url: "/getFleetList",
        method: "get",
        data: {},
      }).then((res) => {
        console.log(res, "车队信息");
        if (res.code === 200) {
          this.showFrmaerList2.push(res.data.plate_number);
          this.showFrmaerList3 = res.data;
        }
      });
    },
    confirmDate({ e, data, index }) {
      this.start_time = e[0];
      this.end_time = e[e.length - 1];
      this.timeIndex = index;
      this.showDateTitle = data;
      if (this.navIndex == 1) {
        this.getSectionFour();
      } else {
        this.getSectionBy();
      }
    },
    showFrmaerBtn(index, k, i = 0) {
      this.showCartIndex = index;
      this.saveIndex = k;
      this.childIndex = i;
      this.showFrmaerList = this["showFrmaerList" + k];
      this.showFrmaer = true;
    },
    confirmshowFrmaer(e) {
      console.log("当前产品----", e);
      if (this.saveIndex == 0) {
        this.list1[this.showCartIndex].farmer_id = e.value[0].farmer_id;
        this.list1[this.showCartIndex].farmer_title = e.value[0].title;
      } else if (this.saveIndex == 1) {
        this.list1[this.showCartIndex].batch = e.value[0].batch;
        this.list1[this.showCartIndex].batch_title = e.value[0].title;
      } else {
        this.list1[this.showCartIndex].plate_train_json[
          this.childIndex
        ].plate_number = e.value[0].title;
      }
      this.showFrmaer = false;
    },
    showCartBtn(k) {
      this.showCartIndex = k;
      this.showCar = true;
    },
    checkObjectsHaveValues(list, k = []) {
      // 遍历list数组中的每个对象
      for (let i = 0; i < list.length; i++) {
        const obj = list[i];
        // 遍历对象中的每个字段
        for (let key in obj) {
          // 检查字段是否有值
          if (k.includes(key) && !obj[key]) {
            console.log(obj[key], obj, key, "obj[key]");
            // 如果字段没有值（为空字符串、null、undefined等），返回false
            return false;
          }
        }
      }

      // 如果所有字段都有值，返回true
      return true;
    },
    submitBtn(k) {
      if (this.navIndex == 1) {
        this.list.forEach((item) => {
          if (!item.pale_date) {
            item.pale_date = new Date()
              .toLocaleDateString()
              .replace(/\//g, "-");
          }
        });
        const arr = ["num", "sku_id", "product_title", "pale_date"];
        const s = this.checkObjectsHaveValues(this.list, arr);
        if (!s && k != 0) {
          uni.showToast({
            title: "请填写完整",
            icon: "none",
          });
          return;
        }
        this.$api({
          url: "/save_production_section_four_product",
          method: "post",
          data: {
            info: this.info,
            details: JSON.stringify(this.list),
            is_draft: k == 0 ? "1" : "0",
            id: this.editId || "",
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          if (res.code === 200 && k != 0) {
            this.list.forEach((item) => {
              Object.keys(item).forEach((v) => (item[v] = ""));
            });
          }
        });
      } else {
        if (!this.service_time) {
          this.service_time = new Date()
            .toLocaleDateString()
            .replace(/\//g, "-");
        }
        if (k != 0 && !this.total_num) {
          uni.showToast({
            title: "请填写日加工总数",
            icon: "none",
          });
          return;
        }
        const key = ["farmer_title", "total", "residual_duck_num"];
        const s = this.checkObjectsHaveValues(this.list1, key);
        if (!s && k != 0) {
          uni.showToast({
            title: "请填写完整",
            icon: "none",
          });
          return;
        }
        this.$api({
          url: "/save_production_section_four_white_bar",
          method: "post",
          data: {
            info: this.info,
            details: JSON.stringify(this.list1),
            is_draft: k == 0 ? "1" : "0",
            total: this.total_num,
            service_time: this.service_time,
            id: this.editId1 || "",
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          if (res.code === 200 && k != 0) {
            this.service_time = "";
            this.total_num = "";
            this.list1 = this.list2;
          }
        });
      }
    },
    confirmPicker(e) {
      this.list[this.showIndex].product_id = e.value[0].product_id;
      this.list[this.showIndex].product_title = e.value[0].title;
      this.list[this.showIndex].sku_id = e.value[0].specifications;
      this.show = false;
    },
    showPrick(k) {
      // this.show = true;
      this.showIndex = k;
      this.toRoute("/select-product");
    },
    getProduct() {
      this.productList = [];
      this.$api({
        url: "/product_specifications",
        method: "get",
      }).then((res) => {
        if (res.code === 200) {
          this.productList.push(res.data);
        }
      });
    },
    addList(k, index) {
      if (k == 0) {
        this.list.push({
          production_section_four_product_no: "",
          pale_date: "",
          product_id: "",
          product_title: "",
          sku_id: "",
          num: "",
          weight: "",
          disabled: false,
        });
      } else if (k == 3) {
        this.list1[index].plate_train_json.push({
          plate_number: "",
          train_number: "",
          disabled: false,
        });
      } else {
        this.list1.push({
          production_section_four_white_bar_no: "",
          farmer_id: "",
          farmer_title: "",
          plate_train_json: [
            {
              plate_number: "",
              train_number: "",
              disabled: false,
            },
          ],
          total: "",
          weight: "",
          residual_duck_num: "",
          residual_duck_weight: "",
          yz_pb_num: "",
          yz_pb_weight: "",
          yz_pb_title: "严重爬背",
          yz_pb_disabled: true,
          dt_num: "",
          dt_weight: "",
          dt_title: "断腿/断翅A",
          dt_disabled: true,
          qw_pb_num: "",
          qw_pb_weight: "",
          qw_pb_title: "轻微爬背",
          qw_pb_disabled: true,
          ht_num: "",
          ht_weight: "",
          ht_title: "抓鸭红头",
          ht_disabled: true,
          yq_num: "",
          yq_weight: "",
          yq_title: "淤青红紫",
          yq_disabled: true,
          dt_num_t: "",
          dt_weight_t: "",
          dt_t_title: "断腿/断翅B",
          dt_t_disabled: true,
          fx_num: "",
          fx_weight: "",
          fx_title: "放血红头",
          fx_disabled: true,
          pp_jq_num: "",
          pp_jq_weight: "",
          pp_jq_title: "破皮_机器",
          pp_jq_disabled: true,
          pp_dj_num: "",
          pp_dj_weight: "",
          pp_dj_title: "破皮_刀具",
          pp_dj_disabled: true,
          pz_num: "",
          pz_weight: "",
          pz_title: "破嘴",
          pz_disabled: true,
          disabled: false,
          batch: "",
          batch_title: "",
        });
      }
    },
    scrollToDate() {
      this.$nextTick(() => {
        const calendar = this.$refs.dateNow;
        // 假设u-calendar组件有scrollToDate方法（具体方法名需参考uView文档）
        if (calendar && calendar.scrollToDate) {
          calendar.scrollToDate(this.defaultDate);
        } else {
          console.error("scrollToDate方法不存在或组件未正确引用");
        }
      });
    },
    showDateBtn(k, l) {
      this.showDate = true;

      this.showIndex = k;
    },
    confirmDate1(e) {
      if (this.navIndex == 1) {
        this.list[this.showIndex].pale_date = e[0];
      } else {
        this.service_time = e[0];
      }

      this.showDate = false;
    },
    // 按键被点击(点击退格键不会触发此事件)
    valChange(val) {
      // 将每次按键的值拼接到value变量中，注意+=写法
      this.list1[this.showCartIndex].plate_number += val;
      console.log(this.value);
    },
    // 退格键被点击
    backspace() {
      // 删除value的最后一个字符
      if (this.list1[this.showCartIndex].plate_number.length)
        this.list1[this.showCartIndex].plate_number = this.list1[
          this.showCartIndex
        ].plate_number.substr(
          0,
          this.list1[this.showCartIndex].plate_number.length - 1
        );
      console.log(this.list1[this.showCartIndex].plate_number);
    },
    tabClick(e) {
      console.log("点击tab", e);
      this.tabCurrent = e.value;
      this.navIndex = 1;
      this.page = 1;
      this.nomore = false;
      this.timeIndex = null;
      this.btTitle = "产品数据统计";
      if (this.tabCurrent == 1) {
        this.getSectionFour();
      } else if (this.tabCurrent == 2) {
        this.loadStatus = "loadmore";
        this.getList();
      }
    },
    //导航一
    navBtn(k) {
      this.navIndex = k;
      if (k == 1) {
        this.info = this.info1;
      } else {
        this.info = this.info2;
      }
      if (this.tabCurrent == 2) {
        this.page = 1;
        this.nomore = false;
        this.loadStatus = "loadmore";
        if (k == 1) {
          this.getList();
        } else {
          this.getList1();
        }
      }
    },
    //加载更多
    loadingMore() {
      if (this.nomore) return;
      this.page++;
      if (this.navIndex == 1) {
        this.getList(true);
      } else {
        this.getList1(true);
      }
    },
    //获取养殖户列表
    getFarmer() {
      this.showFrmaerList0 = [];
      this.$api({
        url: "/farmer_list",
        method: "get",
      }).then((res) => {
        if (res.code == 200) {
          this.showFrmaerList0.push(res.data);
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.section-four {
  width: 100%;
  height: 100%;
  background: #f5f7f9;

  ::v-deep .u-tabs__wrapper__nav__item {
    flex: 1;
  }

  ::v-deep .u-popup {
    flex: 0 !important;
  }

  .header {
    height: 88upx;
    width: 100%;
    background: #fff;
  }

  .nav {
    padding: 20upx 0;

    & > view {
      width: 192rpx;
      height: 52rpx;
      text-align: center;
      line-height: 52upx;
      background: #ffffff;
      border-radius: 8rpx 8rpx 8rpx 8rpx;
      font-size: 24rpx;
      color: #9695a3;
      margin-right: 52upx;
    }

    .nav-ac {
      background: #da4334;
      color: #ffffff;
    }
  }

  .mb16 {
    margin-bottom: 16upx;
  }

  .tip {
    padding: 20upx 32upx;
    font-size: 24rpx;
    color: #a0a0a0;
  }

  .del {
    font-size: 24rpx;
    color: #da4334;
  }

  .add-icon {
    padding: 22upx 0;

    & > image {
      width: 40upx;
      height: 40upx;
    }
  }

  .tr {
    text-align: right;
  }

  .wrap {
    background: #fff;
    padding: 0 32upx;

    .box1 {
      padding: 28upx 0;
      font-size: 32rpx;
      border-bottom: 1rpx solid #e4e4e4;

      &-tip {
        font-weight: bold;
        font-size: 32rpx;
        color: #161616;
        padding-left: 16upx;
        border-left: 4upx solid #da4334;
        margin-bottom: 30upx;
      }

      &-y {
        font-size: 32rpx;
        color: #f17303;
        margin-bottom: 28upx;
        & > input {
          font-size: 32rpx;
          color: #f17303;
        }
      }
      .x {
        font-size: 32rpx;
        color: #da4334;
        margin-left: 20upx;
      }
      & > input {
        font-size: 32rpx;
      }
      &-t {
        font-size: 32rpx;
        color: #171717;

        & > input {
          font-size: 32rpx;
          text-align: right;
        }
      }

      ::-webkit-input-placeholder {
        color: #a0a0a0;
      }
    }

    .box {
      padding: 28upx 0;
      font-size: 32rpx;
      border-bottom: 1rpx solid #e4e4e4;

      & > view {
        font-size: 32rpx;
        color: #161616;
      }

      & > input {
        height: 28upx;
        font-size: 32rpx;
        margin-top: 28upx;
      }

      .box-b {
        margin-top: 28upx;

        & > input {
          height: 28upx;
          font-size: 32rpx;
        }

        & > image {
          width: 12upx;
          height: 21upx;
        }
      }

      ::-webkit-input-placeholder {
        color: #a0a0a0;
      }
    }

    .l-wrap {
      padding: 58upx 8upx 30upx 54upx;

      .l-box {
        position: relative;
        margin-bottom: 38upx;

        &-c {
          position: absolute;
          top: 0;
          left: -32upx;
          width: 16rpx;
          height: 16rpx;
          background: #d7d7d7;
          border-radius: 50%;
        }

        &-line {
          position: absolute;
          top: 28upx;
          left: -25upx;
          width: 2upx;
          height: 100upx;
          background: #d7d7d7;
        }

        &-title {
          font-size: 24rpx;
          color: #a0a0a0;

          & > view:nth-of-type(1) {
            font-size: 32rpx;
            color: #3d3d3d;
            margin-bottom: 12upx;
          }
        }

        &-r {
          &-t {
            font-size: 24rpx;
            color: #a0a0a0;

            & > image {
              width: 68rpx;
              height: 68rpx;
              margin-bottom: 8upx;
            }
          }

          .arrow {
            width: 32upx;
            height: 32upx;
            margin-left: 10upx;
            margin-right: 10upx;
            margin-top: 18upx;
          }

          &-add {
            width: 68rpx;
            height: 68rpx;
            background: #ffffff;
            border-radius: 12rpx 12rpx 12rpx 12rpx;
            border: 2rpx solid #ededed;

            & > image {
              width: 36upx;
              height: 36upx;
            }
          }
        }
      }
    }
  }

  .footer {
    background: #fff;
    padding: 8upx 32upx;

    padding-bottom: env(safe-area-inset-bottom);

    .box-icon {
      font-size: 24rpx;
      color: #000000;

      & > image {
        width: 39upx;
        height: 38upx;
        margin-bottom: 10upx;
      }
    }

    .btn {
      width: 580rpx;
      height: 80rpx;
      background: #da4334;
      border-radius: 422rpx 422rpx 422rpx 422rpx;
      border: 1rpx solid #dafbff;
      font-weight: 500;
      font-size: 28rpx;
      color: #ffffff;
      text-align: center;
      line-height: 80upx;
    }
  }
  .search {
    width: 702rpx;
    height: 68rpx;
    background: #ffffff;
    border-radius: 12rpx 12rpx 12rpx 12rpx;
    border: 2rpx solid rgba(0, 0, 0, 0.06);
    margin: 0 auto 20upx;
    box-sizing: border-box;
    padding: 0 20upx;
    font-size: 28rpx;
    & > image {
      width: 32upx;
      height: 32upx;
      margin-right: 16upx;
    }
  }
  .content-wrap {
    padding: 0 24upx;
    .content-box {
      padding: 32upx 32upx 28upx;
      background: #fff;
      margin-bottom: 20upx;
      font-size: 24rpx;
      color: #8d8d8d;
      .t {
        font-size: 32rpx;
        color: #171717;
      }
      .t1 {
        color: #afafaf;
      }
      .edit-text {
        width: 78rpx;
        height: 36rpx;
        background: #f17303;
        font-size: 24rpx;
        color: #ffffff;
        border-radius: 14upx 0 14upx 0;
        margin-left: 16upx;
        text-align: center;
        line-height: 36upx;
      }
      .no {
        margin-top: 30upx;
        margin-bottom: 12upx;
        color: #8d8d8d;
      }
      .cred {
        font-size: 24rpx;
        color: #da4334;
      }
      .t2 {
        color: #8d8d8d;
      }
      .mb12 {
        margin-bottom: 12upx;
      }
      .ac {
        font-size: 26rpx;
        color: #8d8d8d;
      }
      .ac1 {
        font-size: 26rpx;
        color: #171717;
      }
      .img {
        width: 40upx;
        height: 40upx;
        margin-right: 8upx;
      }
      .ac2 {
        font-size: 26rpx;
        color: #f17303;
      }
      .ac3 {
        font-size: 26rpx;
        color: #0cb18e;
      }
      .ac4 {
        font-size: 26rpx;
        color: #8d8d8d;
      }
      .mt34 {
        margin-top: 34upx;
      }
    }
  }
  .page-set {
    margin: 20upx 0;
  }
  .nav1 {
    height: 88rpx;
    background: #ffffff;
    font-size: 32rpx;
    color: #161616;
    box-sizing: border-box;
    padding: 0 32upx;
    .d-icon {
      width: 20rpx;
      height: 13rpx;
      margin-left: 18upx;
    }
    &-text {
      font-size: 28rpx;
      color: #da4334;
      margin-left: 6upx;
    }
    .e-icon {
      width: 28rpx;
      height: 28rpx;
    }
  }
  .time-box {
    padding: 30upx 32upx 16upx;
    font-size: 28rpx;
    color: #1c2127;
    .d1-icon {
      width: 12upx;
      height: 12upx;
      margin-left: 4upx;
    }
    &-text {
      font-size: 24rpx;
      color: #6f6e74;
      margin-top: 48upx;
    }
  }
  .wrap1 {
    background: #fff;
    padding: 28upx 32upx;
    font-size: 28rpx;
    color: #171717;
    &-num {
      font-size: 48rpx;
      padding: 48upx 0;
      border-bottom: 1rpx solid #e4e4e4;
    }
    &-des {
      font-size: 28rpx;
      color: #161616;
      margin: 28upx 0 24upx;
    }
  }
  .sc {
    color: #da4334;
  }
}
</style>
